package Volume1.ch9;

import java.time.LocalDate;
import java.util.PriorityQueue;

/**
 * 9-5:优先队列测试 demo
 * @Auther jacob
 * @Date 2020/8/15 01:11
 */
public class PriorityQueueTest {
    public static void main(String[] args) {
        PriorityQueue<LocalDate> pq = new PriorityQueue<>();

        pq.add(LocalDate.of(1994, 1, 1));
        pq.add(LocalDate.of(1993, 1, 1));
        pq.add(LocalDate.of(1992, 1, 1));
        pq.add(LocalDate.of(1991, 1, 1));

        for (LocalDate localDate : pq) {
            System.out.println(localDate);
        }

        while (!pq.isEmpty()){
            System.out.println(pq.remove());
        }
    }
}
